package torres.map.effect;

import torres.entity.Entity; 

/**
 * @author Torres
 * A special kind of AreaEffect that hurts the Entity. Has a certain rate and
 * damage value.
 */
@SuppressWarnings("serial")
public class TakeDamage extends AreaEffect {
	private int damage;
	
	
	/**
	 * Creates a new TakeDamage AreaEffect with the default rate of 2 and the default damage of 1. 
	 */
	public TakeDamage()	{
		super(2);
		damage = 1;
	}

	/**
	 * Creates a new TakeDamage AreaEffect with the specified value to be damaged, and the default rate of 2.
	 * @param damage The amount of damage to be inflicted on the Entity.
	 */
	public TakeDamage(int damage) {
		super(2);
		this.damage = damage;
	}

	/** 
	 * Applies the Effect to the specified Entity.
	 * @param entity The Entity to which the affect is being applied.
	 */
	public void applyEffect(Entity entity) {
		entity.setCurrLife(entity.getCurrLife() - damage);
	}
	
	/**
	 * Returns the amount of damage to be inflicted. 
	 * @return The amount of damage to be inflicted.
	 */
	public int getDamage(){
		return this.damage;
	}
	
	/**
	 * Sets the amount of damage inflicted to the specified value.
	 * @param damage The new amount of damage to be inflicted.
	 */
	public void setDamage(int damage){
		this.damage = damage;
	}
	
	/**
	 * Returns the String representation of this TakeDamage.
	 * @return The String representation of this TakeDamage.
	 */
	public String toString() {
		return "Amount damage dealt = " + damage;
	}
}